<?php
class CAdminLogin
{
	static function checkLogin($p_strUsername, $p_strPwd, $p_strCountry)
	{
		$arrResult = QAdminLogin::getAdminInfo($p_strUsername, md5($p_strPwd), $p_strCountry);
		if ($arrResult)
		{
			$AppUI 						= Zend_Registry::get('AppUI');
			$AppUI->admin_id 			= $arrResult[0]['admin_id'];
			$AppUI->admin_username 		= $arrResult[0]['admin_username'];
			$AppUI->admin_lastlogin 	= $arrResult[0]['admin_lastlogin'];
			$AppUI->admin_group_id 		= $arrResult[0]['group_id'];
			$AppUI->admin_group_leader 	= $arrResult[0]['group_leader'];
			$AppUI->admin_category	 	= $arrResult[0]['category'];
			$AppUI->country			 	= $p_strCountry;
			#$AppUI->admin_func = CAdminFunc::getByAdminId($arrResult[0]['admin_id']);
			$AppUI->save();
			return true;
		}
		return false;
	}
	
	public function doLogout()
	{
		$AppUI = Zend_Registry::get('AppUI');
		$AppUI->destroy();
	}
}
?>